home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-13 | 3.1 KB | 139 lines | [TEXT/ds30] |
- /*
- blaster
- ds
- ds
- open database master;
- execute file "setting";
- setting;
- go
- */
-
- declare procedure hello()
- {
- cursor vars, userinfo;
-
- set $maxrows = $null;
- describe open dbms into vars;
- fetch of vars;
- print 'Hello "' + $user + '" you are using brand "' + vars->brand
- + '" version "' + vars->rev + '"';
-
- describe open databases into vars;
- if ($rows(vars))
- {
- fetch of vars;
- print "The current database alias is :", vars->alias;
-
- select CreatorName, AbortTimeout
- from System.SysUsers
- where Name = $user
- into userinfo;
-
- fetch of userinfo;
- if ($sqlcode = 0)
- {
- print $format("\tALTER CREATOR %s;", userinfo->CreatorName);
- print $format("\tALTER ABORT TIME %s;", userinfo->AbortTimeout);
- }
- }
- }
- end procedure hello;
-
- declare procedure str(x)
- returns varchar;
- argument generic x;
- {
- if (x IS NULL) return("NULL");
- return varchar x;
- }
- end procedure str;
-
- declare procedure results()
- returns varchar;
- {
- varchar text;
-
- text = 'CURRENT RESULTS:'
- + $format ('\n\t$sqlcode = %d', $sqlcode)
- + $format (', $rowcnt = %s', str($rowcnt))
- + $format (', $colcnt = %s', str($colcnt))
- + $format (', $rowsaffected = %s', str($rowsaffected));
- return text;
- }
- end procedure results;
-
- declare procedure setting (level)
- argument int level = 4;
- {
- cursor vars;
- varchar text;
-
- text = results();
- hello();
- print text;
- if (level == 1)
- return;
- print 'RESOURCE LIMITING:';
- print ' SET $maxrows =', $maxrows,
- '; $rowsperpage =', $rowsperpage,
- '; $locktimeout =', $locktimeout,
- '; $rowlocking = ', $rowlocking, ';';
-
- if (level == 2)
- return;
-
- print 'DECIMAL AND MONEY:';
- print ' SET $decfmt = "' + $decfmt + '"; $moneyfmt = "' + $moneyfmt + '";';
-
- print 'DATE AND TIME:';
- print ' SET $tsfmt = "' + $tsfmt + '"; $datefmt = "' + $datefmt
- + '"; $timefmt = "' + $timefmt + '";';
- print ' SET $month = "' + $month + '";' ;
- print ' SET $day = "' + $day + '"; $ampm = "' + $ampm + '";';
-
- if (level == 3)
- return;
- print 'GLOBAL SYSTEM VARIABLES:';
- errorctl 1;
- open database Master;
- errorctl 0;
- use database Master;
-
- set $maxrows = $null;
-
- select B.Name, int A.Value as Value
- from Master!System.SysVariables as A,
- Master!System.SysObjects as B
- where A.DBID /= B.DBID
- and A.DataType == $integer
- and A.VariableType == 'Par'
- into vars;
- for each vars
- print $format("\tSET VARIABLE %-25s = %d;", vars->Name, vars->Value);
-
- select B.Name, boolean A.Value as Value
- from Master!System.SysVariables as A,
- Master!System.SysObjects as B
- where A.DBID /= B.DBID
- and A.DataType == $boolean
- and A.VariableType == 'Par'
- into vars;
- for each vars
- print $format("\tSET VARIABLE %-25s = %d;", vars->Name, vars->Value);
-
- select B.Name, varchar A.Value as Value
- from Master!System.SysVariables as A,
- Master!System.SysObjects as B
- where A.DBID /= B.DBID
- and A.DataType == $varchar
- and A.VariableType == 'Par'
- into vars;
- for each vars
- print $format("\tSET VARIABLE %-25s = '%s';", vars->Name, vars->Value);
-
- print "Database 'Master' is open, to receive your settings";
- }
- end procedure setting;
-
-
- setting;